package deepr.core;

import deepr.anno.SchemaType;
import deepr.behaviour.RequestDispose;
import deepr.entity.DeeprInfoResponse;
import deepr.entity.DeeprListResponse;
import deepr.entity.DeeprRequest;
import deepr.entity.Response;
import deepr.filter.DbFilterBehavior;
import deepr.src.DeeprMapper;
import lombok.Data;

import java.util.HashMap;
import java.util.Map;

@Data
public abstract class DisposeContext {

  private Map<String, Object> requestParams;
  private SchemaData schemaData;
  private SchemaType schemaType;
  private DbFilterBehavior dbFilterBehavior;

  private Map<String, Object> filterParams = new HashMap<>();
  private Response<?> response = null;

  public void reset() {
    filterParams = new HashMap<>();
    response = null;
  }

  public abstract DeeprMapper getDeeprMapper();

  public <T> Response<T> getResponse() {
    return (Response<T>) response;
  }

  public String getString(String key) {
    return (String) requestParams.get(key);
  }

  public Number getNumber(String key) {
    return (Number) requestParams.get(key);
  }

}
